<template>
  <div
    class="navbar"
    :style="{
      height: pageSetup.titleHeight + 'px'
    }"
  >
    <!-- 左半部分 -->
    <div class="lef" v-show="pageSetup.isBack">
      <van-icon name="arrow-left" />
    </div>
    <!-- 标题 -->
    <div
      class="header-title"
      :style="{
        height: pageSetup.titleHeight + 'px',
        'line-height': pageSetup.titleHeight + 'px'
      }"
    >
      {{ pageSetup.name }}
    </div>
    <!-- 右半部分 -->
    <div class="rig" v-show="pageSetup.isPerson">
      <span>个人中心</span>
    </div>
  </div>
</template>

<script lang="ts" setup name="navbar">
import { toRefs } from "vue";
const props = defineProps({
  pageSetup: {
    type: Object
  }
});
const { pageSetup } = toRefs(props);
</script>

<style lang="scss" scoped>
.navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 35px;
  cursor: pointer;
  background: #ffffff;
  border-bottom: 1px solid #f7f8fa;

  /* 左边 */
  .lef {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);

    /* 图标 */
    span {
      font-size: 12px;
      font-weight: 400;
      color: #000000;
    }
  }
  .header-title {
    width: 100%;
    font-size: 14px;
    line-height: 35px;
    color: #333333;
    text-align: center;
  }

  /* 右边 */
  .rig {
    // display: flex;
    // align-items: center;
    // height: 100%;
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);

    /* 搜索图标 */
    i {
      margin: 0 7px 5px;
      font-size: 18px;
    }

    /* 文字 */
    span {
      margin: 0 7px;
      font-size: 12px;
    }
  }
}
</style>
